from enum import Enum

from bct.tools.http.trade.bct4_trade_dto import Product, ProductTypeEnum, CallOrPutEnum


class ExerciseTypeEnum(Enum):
    EUROPEAN = 'EUROPEAN'


class VanillaDTO(Product):
    last_observation_date: str = ''
    exercise_type: ExerciseTypeEnum = ExerciseTypeEnum.EUROPEAN
    call_or_put: CallOrPutEnum

    def __init__(self,
                 strike_price: str,
                 initial_price: str,
                 notional: str,
                 call_or_put: CallOrPutEnum
                 ):
        super(VanillaDTO, self).__init__()
        self.product_type = ProductTypeEnum.VANILLA_EUROPEAN
        self.strike_price = strike_price
        self.initial_price = initial_price
        self.notional = notional
        self.call_or_put = call_or_put

    def to_dict(self):
        json_obj = Product.to_dict(self)
        json_obj['lastObservationDate'] = self.last_observation_date
        json_obj['exerciseType'] = self.exercise_type.value
        json_obj['callOrPut'] = self.call_or_put.value
        return json_obj
